"""
房产信息 task
"""
from com.data.extract.hourse.hourse import DevelopmentInvestmentExtract
from com.data.task.task import Task
from com.data.cache.cache import DictCache


class HourseTask(Task):
    pass


import time


class DevelopmentInvestmentTask(HourseTask):
    def task(self):
        hourseExtract = DevelopmentInvestmentExtract()
        r = hourseExtract.extract()
        cache = DictCache()
        cache.put(DevelopmentInvestmentTask.__name__, r.json()["returndata"])
        cache.get(DevelopmentInvestmentTask.__name__)

        r2 = hourseExtract.extract(
            url="http://data.stats.gov.cn/easyquery.htm?m=QueryData&dbcode=hgyd&rowcode=zb&colcode"
                "=sj&wds=%5B%5D&dfwds=%5B%7B%22wdcode%22%3A%22sj%22%2C%22valuecode%22%3A%222000-%22"
                "%7D%5D&k1=" + str(
                round(time.time() * 1000)))
        print(r2.json()["returndata"])

        # r3 = hourseExtract.extract(url="http://data.stats.gov.cn/easyquery.htm?m=QueryData&dbcode=hgyd&rowcode=zb"
        #                                "&colcode=sj&wds=%5B%5D&dfwds=%5B%7B%22wdcode%22%3A%22zb%22%2C%22valuecode%22"
        #                                "%3A%22A020924%22%7D%5D&k1=1596784669128&h=1")
        #
        # r4 = hourseExtract.extract(url="http://data.stats.gov.cn/easyquery.htm?m=QueryData&dbcode=hgyd&rowcode=zb"
        #                                "&colcode=sj&wds=%5B%5D&dfwds=%5B%7B%22wdcode%22%3A%22sj%22%2C%22valuecode%22"
        #                                "%3A%22LAST24%22%7D%5D&k1=1596784718633")
        #
        # print(r4.json())
        print("1")
        while True:
            pass


if __name__ == "__main__":
    task = DevelopmentInvestmentTask()
    task.task()
